package com.ndp.fb.model.fbagent.param;

import com.ndp.fb.annotation.FBParam;
import com.ndp.fb.model.fbagent.result.AbstractFacebookResult;
import com.restfb.DefaultJsonMapper;
import com.restfb.JsonMapper;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Map;

/**
 * Created by infi on 2015/1/21.
 */
@Setter
@Getter
@NoArgsConstructor
public class FacebookParam implements Serializable {

    //账号
    private String accessToken;

    @FBParam("account_id")
    private Long fbAccountId;

    private Boolean removeAccountFromUrl;

    //优先级
//    @FBParam("bbbbbb")
    private Integer apiPriorityCode;
    //resultClassName
//    @FBParam("resultClassName")
    private String resultClassName;

    //异步回调相关
    private Map<String, String> equipment;
    private Boolean callBack;
    private String apiCallbackTargetType;

    @FBParam("locale")
    private String locale;

    @FBParam("fields")
    private String fields;
    @FBParam("filtering")
    private String filtering;
    @FBParam("sort")
    private String sort;
    @FBParam("limit")
    private Integer limit;
    @FBParam("offset")
    private Integer offset;
    @FBParam("after")
    private String after;
    private String method;
    private Long lastUpdatedTime;


    public String getResultClassName() {
        return resultClassName;
    }

    public void setResultClass(Class<? extends AbstractFacebookResult> resultClassName) {
        this.resultClassName = resultClassName.getName();
    }

    @Override
    public String toString() {
        JsonMapper jsonMapper = new DefaultJsonMapper();
        return jsonMapper.toJson(this);

    }

}
